#ifndef prs_FrmPageControlStyle_H
#define prs_FrmPageControlStyle_H

#include "prs_FrmFunc.h"
#include "prs_FrmRules.h"
#include "prs_FrmStyleState.h"
#include "frm_control_TPageControl.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmPageControlStyle : public TNodeStyleControl
{
  DECLARE_ClientNode()
  TAttrNodeType<nodeType_PageControl> NodeType;
  TAttrObject<nodeType_Style,frm::control::TPageControl::TStyle> Style;
  //
  TNodeFrmPageControlStyle() : NodeType(this),Style(this) {}
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmPageControlStyle : public snt::TRule
{
  TRuleFrmPageControlStyle(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmStyleState &RStyleState
  );
  
private:  
  TNodeFrmPageControlStyle *GetNode() { return dynamic_cast<TNodeFrmPageControlStyle*>(vParentNode.Pointer());}
  //
  void FClient(snt::TParams &Params)      { rStyleState.SetState( &GetNode()->Style.Value.Client );  }
  void FButtons(snt::TParams &Params)     { rStyleState.SetState( &GetNode()->Style.Value.Buttons ); }
  void FPageControl(snt::TParams &Params) { rStyleState.SetState( &GetNode()->Style.Value );		 }
  //
  svl::TVariant &vParentNode;
  snt::TAlter A;
  TRuleFrmStyleState &rStyleState;
};

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

struct TNodeFrmPageStyle : public TNodeStyleControl
{
  DECLARE_ClientNode()
  TAttrNodeType<nodeType_Page> NodeType;
  TAttrObject<nodeType_Style,frm::control::TPage::TStyle> Style;
  //
  TNodeFrmPageStyle() : NodeType(this),Style(this) {}
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmPageStyle : public snt::TRule
{
  TRuleFrmPageStyle(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmStyleState &RStyleState
  );
  
private:  
  TNodeFrmPageStyle *GetNode() { return dynamic_cast<TNodeFrmPageStyle*>(vParentNode.Pointer());}
  //
  void FPage(snt::TParams &Params)  { rStyleState.SetState( &GetNode()->Style.Value );  }
  //bool FPageButton(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  //
  svl::TVariant &vParentNode;
  snt::TAlter A;
  TRuleFrmStyleState &rStyleState;
};


}

#endif
